package spt.mc.demo.util;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.List;
import cn.hutool.json.JSONUtil;
import spt.mc.demo.entity.Item;
import spt.mc.demo.entity.McImg;

public class GenerateUtil {

	public static String itemStr="[{\"name\":\"机房、滑轮间环境\",\"need\":\"清洁，门窗完好，照明正常\"},"
			+ "{\"name\":\"手动紧急操作装置\",\"need\":\"齐全，在指定位置\"},"
			+ "{\"name\":\"驱动主机\",\"need\":\"运行时无异常振动和异常声响\"},"
			+ "{\"name\":\"制动器各销轴部位\",\"need\":\"动作灵活\"},"
			+ "{\"name\":\"制动器作为轿厢意外移动保护 装置制停子系统时的自监测\",\"need\":\"制动力人工方式检测符合使用维护说明书要 求；制动力自监测系统有记录\"},"
			+ "{\"name\":\"制动器间隙\",\"need\":\"打开时制动衬与制动轮不应发生摩擦，间隙 值符合制造单位要求\"},"
			+ "{\"name\":\"编码器\",\"need\":\"清洁，安装牢固\"},"
			+ "{\"name\":\"限速器各销轴部位\",\"need\":\"润滑，转动灵活；电气开关正常\"},"
			+ "{\"name\":\"层门和轿门旁路装置\",\"need\":\"工作正常\"},"
			+ "{\"name\":\"紧急电动运行\",\"need\":\"工作正常\"},"
			+ "{\"name\":\"轿顶\",\"need\":\"清洁，防护栏安全可靠\"},"
			+ "{\"name\":\"轿顶检修开关、停止装置\",\"need\":\"工作正常\"},"
			+ "{\"name\":\"导靴上油杯\",\"need\":\"吸油毛毡齐全，油量适宜，油杯无泄漏\"},"
			+ "{\"name\":\"对重/平衡重块及其压板\",\"need\":\"对重/平衡重块无松动，压板紧固\"},"
			+ "{\"name\":\"井道照明\",\"need\":\"齐全，正常\"},"
			+ "{\"name\":\"轿厢照明、风扇、应急照明\",\"need\":\"工作正常\"},"
			+ "{\"name\":\"轿厢检修开关、停止装置\",\"need\":\"工作正常\"},"
			+ "{\"name\":\"轿内报警装置、对讲系统\",\"need\":\"工作正常\"},"
			+ "{\"name\":\"轿内显示、指令按钮、IC 卡系统\",\"need\":\"齐全，有效\"},"
			+ "{\"name\":\"轿门防撞击保护装置( 安全触  板，光幕、光电等)\",\"need\":\"功能有效\"},"
			+ "{\"name\":\"轿门门锁电气触点\",\"need\":\"清洁，触点接触良好，接线可靠\"},"
			+ "{\"name\":\"轿门运行\",\"need\":\"开启和关闭工作正常\"},"
			+ "{\"name\":\"轿厢平层准确度\",\"need\":\"符合标准值\"},"
			+ "{\"name\":\"层站召唤、层楼显示\",\"need\":\"齐全，有效\"},"
			+ "{\"name\":\"层门地坎\",\"need\":\"清洁\"},"
			+ "{\"name\":\"层门自动关门装置\",\"need\":\"正常\"},"
			+ "{\"name\":\"层门门锁自动复位\",\"need\":\"用层门钥匙打开手动开锁装置释放后，层门门 锁能自动复位\"},"
			+ "{\"name\":\"层门门锁电气触点\",\"need\":\"清洁，触点接触良好，接线可靠\"},"
			+ "{\"name\":\"层门锁紧元件啮合长度\",\"need\":\"不小于 7mm\"},"
			+ "{\"name\":\"底坑环境\",\"need\":\"清洁，无渗水、积水，照明正常\"},"
			+ "{\"name\":\"底坑停止装置\",\"need\":\"工作正常\"}]";
	
	
	public static String imgStr="[{"
			+ "		\"type\": \"机房\","
			+ "		\"img\": \"https://file.sptesyun.com/edsp/dfbef15777274393821361eaf8933027.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=edspminio%2F20220114%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220114T082619Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=388361d08e2b2930d07b6aef85f9f3ed85a8db472af146d71f8492766f3559cf\""
			+ "	},"
			+ "	{"
			+ "		\"type\": \"轿厢\","
			+ "		\"img\": \"https://file.sptesyun.com/edsp/dfbef15777274393821361eaf8933027.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=edspminio%2F20220114%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220114T082619Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=388361d08e2b2930d07b6aef85f9f3ed85a8db472af146d71f8492766f3559cf\""
			+ "	},"
			+ "	{"
			+ "		\"type\": \"轿顶\","
			+ "		\"img\": \"https://file.sptesyun.com/edsp/dfbef15777274393821361eaf8933027.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=edspminio%2F20220114%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220114T082619Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=388361d08e2b2930d07b6aef85f9f3ed85a8db472af146d71f8492766f3559cf\""
			+ "	}"
			+ "]";
	
	
	public static List<Item> generateItem(){
		List<Item> mcData=JSONUtil.toList(itemStr, Item.class);
		return mcData;
	}
	
	public static List<McImg> generateMcImg(){
		List<McImg> mcImg=JSONUtil.toList(imgStr, McImg.class);
		for (McImg img : mcImg) {
			try {
				img.setImg(URLEncoder.encode(img.getImg(), "utf-8"));
			} catch (UnsupportedEncodingException e) {
				e.printStackTrace();
			}
		}
		return mcImg;
	}
}
